From 3a29c76b2ba1a0496c1bd7b0f766891bcfd3a8f6 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 18 Feb 2005 10:55:58 +0000 Subject: [PATCH] logging table encoding fix -- hopefully it actually works, as I haven't seen feedback from 4.1 testers --- maintenance/tables.sql | 2 +- maintenance/updaters.inc | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/maintenance/tables.sql b/maintenance/tables.sql index 1935fcc766..6e615bc3e1 100644 --- a/maintenance/tables.sql +++ b/maintenance/tables.sql @@ -328,7 +328,7 @@ CREATE TABLE /*$wgDBprefix*/logging ( -- Key to the page affected. Where a user is the target, -- this will point to the user page. log_namespace tinyint unsigned NOT NULL default 0, - log_title varchar(255) NOT NULL default '', + log_title varchar(255) binary NOT NULL default '', -- Freeform text. Interpreted as edit history comments. log_comment varchar(255) NOT NULL default '', diff --git a/maintenance/updaters.inc b/maintenance/updaters.inc index 58eb0cc7d0..4d0c9d5ea4 100644 --- a/maintenance/updaters.inc +++ b/maintenance/updaters.inc @@ -248,6 +248,26 @@ function do_group_update() { } } +/** + * 1.4 betas were missing the 'binary' marker from logging.log_title, + * which causes a collation mismatch error on joins in MySQL 4.1. + */ +function do_logging_encoding() { + global $wgDatabase; + $logging = $wgDatabase->tableName( 'logging' ); + $res = $wgDatabase->query( "SELECT log_title FROM $logging LIMIT 0" ); + $flags = explode( ' ', mysql_field_flags( $res, 0 ) ); + $wgDatabase->freeResult( $res ); + + if( in_array( 'binary', $flags ) ) { + echo "Logging table has correct title encoding.\n"; + } else { + echo "Fixing title encoding on logging table... "; + dbsource( 'maintenance/archives/patch-logging-title.sql', $wgDatabase ); + echo "ok\n"; + } +} + function do_schema_restructuring() { global $wgDatabase; $fname="do_schema_restructuring"; @@ -413,7 +433,8 @@ function do_all_updates() { do_watchlist_update(); flush(); do_user_update(); flush(); do_copy_newtalk_to_watchlist(); flush(); - + do_logging_encoding(); flush(); + do_schema_restructuring(); flush(); if ( isTemplateInitialised() ) { -- 2.20.1